package com.yg.ssm.index.ctrl;

import com.alibaba.fastjson.JSONObject;
import com.yg.ssm.index.serv.MenuTreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/8/29.
 */
@Controller
@RequestMapping("/admin")
public class MenuTreeCtronller {
    @Autowired
    private MenuTreeService menuTreeS;

    /**
     * @desc 根据Pid查询菜单数据，默认为0，查询全部菜单
     **/
    @RequestMapping(value = "/menu/tree/query", method = RequestMethod.GET)
    @ResponseBody
    public List<JSONObject> queryMenuTree(@RequestParam(name = "pid", required = false, defaultValue = "0") String pid) {

        return menuTreeS.queryMenuTreeList(pid);
    }

    public void setMenuTreeS(MenuTreeService menuTreeS) {
        this.menuTreeS = menuTreeS;
    }
}
